import { WX_CODE_URL, WX_APPID } from './constant'

// const wxBaseUrl = 'http://localhost:8080'
const wxApiUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize'
// const wxAppSecret = '0e71b8c395ff717c11815a5d6680b501'

export default class {
  // 换取微信code
  static wxCode () {
    let params = {
      appid: WX_APPID,
      redirect_uri: encodeURIComponent(WX_CODE_URL),
      response_type: 'code',
      scope: 'snsapi_userinfo',
      state: 'renrentongxing'
    }
    let gourl = `${wxApiUrl}?appid=${params.appid}&redirect_uri=${params.redirect_uri}&response_type=code&scope=${params.scope}&state=${params.state}#wechat_redirect`
    window.location.href = gourl
  }
}
